package com.dudu.pushtest;

import android.content.Context;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;

import com.mob.MobApplication;
import com.mob.MobSDK;
import com.mob.pushsdk.MobPush;
import com.mob.pushsdk.MobPushCustomMessage;
import com.mob.pushsdk.MobPushNotifyMessage;
import com.mob.pushsdk.MobPushReceiver;

public class DuduApplication extends MobApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        MobPush.addPushReceiver(new MobPushReceiver() {
            @Override
            public void onCustomMessageReceive(Context context, MobPushCustomMessage message) {
                //接收自定义消息(透传)
                System.out.println("onCustomMessageReceive:" + message.toString());
                Toast.makeText(MobSDK.getContext(), "回调信息\n" + (String) message.toString(), Toast.LENGTH_LONG).show();
            }

            @Override
            public void onNotifyMessageReceive(Context context, MobPushNotifyMessage message) {
                //接收通知消
                System.out.println("MobPush onNotifyMessageReceive:" + message.toString());
                Toast.makeText(MobSDK.getContext(), "回调信息\n" + (String) message.toString(), Toast.LENGTH_LONG).show();


            }

            @Override
            public void onNotifyMessageOpenedReceive(Context context, MobPushNotifyMessage message) {
                //接收通知消息被点击事件
                System.out.println("MobPush onNotifyMessageOpenedReceive:" + message.toString());
                Toast.makeText(MobSDK.getContext(), "回调信息\n" + (String) message.toString(), Toast.LENGTH_LONG).show();
            }

            @Override
            public void onTagsCallback(Context context, String[] tags, int operation, int errorCode) {
                //接收tags的增改删查操作
                System.out.println("onTagsCallback:" + operation + "  " + errorCode);
                Toast.makeText(MobSDK.getContext(), "onTagsCallback\n" + operation + "  " + errorCode, Toast.LENGTH_LONG).show();
            }

            @Override
            public void onAliasCallback(Context context, String alias, int operation, int errorCode) {
                //接收alias的增改删查操作
                System.out.println("onAliasCallback:" + alias + "  " + operation + "  " + errorCode);
                Toast.makeText(MobSDK.getContext(), "onAliasCallback\n" + alias + "  " + operation + "  " + errorCode, Toast.LENGTH_LONG).show();
            }
        });
    }
}
